package c3g;

import java.io.*;
import java.util.ArrayList;
import java.util.Properties;

public class Port {
    private String Major;
    private String Minor;
    private String filename;
    private ArrayList<Item> list =new ArrayList<>();
    //获取协议号
    public void getport(String filepro1, File file2) throws IOException {
        Properties props1 =new Properties();
        InputStream in = new FileInputStream(filepro1);
        props1.load(in);
        this.filename = file2.getName().substring(0, file2.getName().lastIndexOf("."));  //读取文件名
        String value =(String) props1.get(filename);
        if(value != null){
            String [] one =value.split(",");        //将读取到的value分割
            if (one.length>=2){
                this.Major =one[0];
                this.Minor =one[1];
            }
        }
        else{
            this.Major=null;
        }

    }
    public ArrayList<c3g.Item> getlist() {
        return list;
    }
    public void setlist(ArrayList<c3g.Item> list) {
        this.list = list;
    }
    public String getMajor(){

        return Major;
    }
    public void setMajor(String Major) {

        this.Major = Major;
    }
    public String getMinor() {

        return Minor;
    }
    public void setMinor(String Minor) {

        this.Minor = Minor;
    }
    public String getFilename() {

        return filename;
    }
    public void setFilename(String filename) {

        this.filename = filename;
    }
}

